package com.alex.maze.level.block;

import com.alex.maze.entities.Entity;
import com.alex.maze.graphics.Sprite;
import java.util.ArrayList;
import java.util.List;

public class Block
{
    public boolean blockMotion = false; // Ajd ali ne verujem da cu da imam pokretne zidove.
    public boolean solidRender = false; // Da li ce zid da se iscrta ili ne.
    
    public String[] messages;
    
    public static Block cvrstZid = new SolidBlock(); // Da ih mozda preimenujem u tiles?

    public List<Sprite> sprites = new ArrayList<Sprite>();
    public List<Entity> entities = new ArrayList<Entity>();
    
    public int tex = 0;
    public int boja = 0x333333;
    
    public int bojaPoda = 0x202020;
    public int bojaPlafona = 0x202020;
    
    public int teksturaPoda;
    public int teksturaPlafona;
    
    public void addSprite(Sprite sprite)
    {
        sprites.add(sprite);
    }

    public boolean use()
    {
        return false;
    }
    
    public void update()
    {
        for(int i = 0; i < sprites.size(); i++)
        {
            Sprite sprite = sprites.get(i);
            sprite.update();
            if (sprite.removed)
            {
                sprites.remove(i--);
            }
        }
    }

    public void removeEntity(Entity entity)
    {
        System.err.println("Removing ---> " + entity);
        entities.remove(entity);
    }
    
    public void addEntity(Entity entity)
    {
        System.err.println("Adding ---> " + entity);
        entities.add(entity);
    }
}
